import { Controller, Get, Module, UseInterceptors } from "@nestjs/common";
import { PrismaClient } from "@prisma/client";
import { WebResult } from "src/common/web.result";
import { AdminLoginInterceptor } from "src/admin/interceptor/alogin.interceptor";
import { UserModule } from "src/user/user.module";

@Controller("/admin/user")
@UseInterceptors(AdminLoginInterceptor)
export class AdminUserController {
  constructor(private readonly prisma: PrismaClient) {}

  @Get("/count")
  async getUserCount() {
    const count = await this.prisma.user.count();
    return WebResult.success(count);
  }
}

@Module({
  imports: [UserModule],
  controllers: [AdminUserController],
})
export class AdminUserModule {}
